﻿/// <reference path="turbo_common.js" />
/// <reference path="../General/Json.js" />

var $ResponseControl = TA.Turbo.Common.ResponseControl = function ResponseControl()
{
	this.Value = undefined;
}
$ResponseControl.Inherit(BaseJsonDeserializable);

$ResponseControl.prototype.Id = "";
$ResponseControl.prototype.Value = null;
$ResponseControl.prototype.Properties = null;

$ResponseControl.prototype.DeserializeContent = function DeserializeContent(prShortName, value)
{
	switch (prShortName)
	{
		case "I": this.Id = value; break;
		case "V": this.Value = value; break;
		case "P": this.Properties = value; break;
	}
}

$ResponseControl.prototype.Process = function Process()
{
	var control = $(this.Id);
	if (control != null)
	{

		if (this.Properties != null)
		{
			for (var prShortName in this.Properties)
			{
				var prName = TA.Turbo.Common.GetPropertyNameByShort(control, prShortName);
				control.get_Object()["set_" + prName + "Serialized"](this.Properties[prShortName]);
			}
		}

		if (this.Value !== undefined)
			control.get_Object().set_SerializedValue(this.Value);
	}
}